package com.chuangke.mds.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.common.db.page.CkPageQuery;
import com.chuangke.common.http.HttpResult;
import com.chuangke.mds.entity.TechnologyTypeParamConf;
import com.chuangke.mds.service.TechnologyTypeParamConfService;

@RestController
@RequestMapping("zchkcl/technologyTypeParamConf")
public class TechnologyTypeParamConfController {

	@Autowired
	private TechnologyTypeParamConfService technologyTypeParamConfService;

	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping(value = "/save")
	public HttpResult save(@RequestBody TechnologyTypeParamConf record) {
		return HttpResult.ok(technologyTypeParamConfService.saveOrUpdate(record));
	}


	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping(value = "/delete")
	public HttpResult delete(@RequestBody List<String> billIds) {
		technologyTypeParamConfService.delete(billIds);
		return HttpResult.ok();
	}
	
	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping("/page")
	public HttpResult page(@RequestBody Map<String, Object> params) {
		return HttpResult.ok(technologyTypeParamConfService.page(new CkPageQuery(params)));
	}
	

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping("/load")
	public HttpResult load(@RequestParam String id) {
		return HttpResult.ok(technologyTypeParamConfService.load(id));
	}

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping("/getList")
	public HttpResult getList(@RequestParam String confType) {
		return HttpResult.ok(technologyTypeParamConfService.getList(confType));
	}

}
